<?php
namespace app\teacher\controller;
use app\common\Base;
use app\common\TeacherModel;
use think\Db;

class TeacherQuery extends Base {
	
	public function index() {
		return $this->fetch();
	}

	public function pageQuery() {
		$where = [];
		$grade = input("grade");
		$subject = input("subjectId");
		$name = input("teacherName");
		$page = input("page");
		$rows = input("rows");
		if($grade) {
			$array = explode("_", $grade);
			$where["年级号"] = array("eq", $array[0]);
			$where["学籍类型"] = array("eq", $array[1]);
		}
		if($subject) $where["任教学科ID"] = array("eq", $subject);
		if($name) $where["姓名"] = array("like", $name."%");
		$fields = ("ID,姓名,年级号,学籍类型,任教学科ID,手机号,离校学期ID");
		$Model = new TeacherModel();
		return $Model->getTeacherList($page, $rows, $fields, $where);
	}

}
